package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.DonatedBookRequestCommnets;
import com.pgybook.db.entity.domain.DonatedBookRequestCommnetsEx;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Repository
public interface DonatedBookRequestCommnetsMapper {
    int countByExample(DonatedBookRequestCommnetsEx example);

    int deleteByExample(DonatedBookRequestCommnetsEx example);

    @Delete({
            "delete from donatedbookrequestcommnets",
            "where DONATEDBOOKREQUESTCOMMNETID = #{donatedbookrequestcommnetid,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long donatedbookrequestcommnetid);

    @Insert({
            "insert into donatedbookrequestcommnets (DONATEDBOOKREQUESTID, AUTHORTYPE, ",
            "AUTHORID, CONTENT, ",
            "CRTTIME, READSTATUS)",
            "values (#{donatedbookrequestid,jdbcType=BIGINT}, #{authortype,jdbcType=INTEGER}, ",
            "#{authorid,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, ",
            "#{crttime,jdbcType=TIMESTAMP}, #{readstatus,jdbcType=INTEGER})"
    })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "donatedbookrequestcommnetid", before = false, resultType = Long.class)
    int insert(DonatedBookRequestCommnets record);

    int insertSelective(DonatedBookRequestCommnets record);

    List<DonatedBookRequestCommnets> selectByExample(DonatedBookRequestCommnetsEx example);

    @Select({
            "select",
            "DONATEDBOOKREQUESTCOMMNETID, DONATEDBOOKREQUESTID, AUTHORTYPE, AUTHORID, CONTENT, ",
            "CRTTIME, READSTATUS",
            "from donatedbookrequestcommnets",
            "where DONATEDBOOKREQUESTCOMMNETID = #{donatedbookrequestcommnetid,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    DonatedBookRequestCommnets selectByPrimaryKey(Long donatedbookrequestcommnetid);

    int updateByExampleSelective(@Param("record") DonatedBookRequestCommnets record, @Param("example") DonatedBookRequestCommnetsEx example);

    int updateByExample(@Param("record") DonatedBookRequestCommnets record, @Param("example") DonatedBookRequestCommnetsEx example);

    int updateByPrimaryKeySelective(DonatedBookRequestCommnets record);

    @Update({
            "update donatedbookrequestcommnets",
            "set DONATEDBOOKREQUESTID = #{donatedbookrequestid,jdbcType=BIGINT},",
            "AUTHORTYPE = #{authortype,jdbcType=INTEGER},",
            "AUTHORID = #{authorid,jdbcType=BIGINT},",
            "CONTENT = #{content,jdbcType=VARCHAR},",
            "CRTTIME = #{crttime,jdbcType=TIMESTAMP},",
            "READSTATUS = #{readstatus,jdbcType=INTEGER}",
            "where DONATEDBOOKREQUESTCOMMNETID = #{donatedbookrequestcommnetid,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(DonatedBookRequestCommnets record);
}
